﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace LowCoding.API
{
    /// <summary>
    /// 跨域配置
    /// </summary>
    public class CrosFilter : IActionFilter
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        public void OnActionExecuted(ActionExecutedContext context)
        {
            context.HttpContext.Request.Headers.Add("Access-Control-Allow-Headers", "*");
            context.HttpContext.Request.Headers.Add("Access-Control-Allow-Methods", "*");
            context.HttpContext.Request.Headers.Add("Access-Control-Max-Age", new Microsoft.Extensions.Primitives.StringValues("24*60*60"));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="context"></param>
        public void OnActionExecuting(ActionExecutingContext context)
        {
        }
    }
}